<?php
namespace common\models;
use yii\db\ActiveRecord;

class Test extends ActiveRecord{
	public function scenarios(){
	    return [
	        'create' => ['name', 'phone', 'sex', 'time'],
	        'update' => ['status'],
	    ];
	}
	public function rules(){
		return [
			[['name', 'age', 'phone'], 'required',],
			['name', 'string', 'max' => 6, 'min' => 2,],
			['sex', 'default', 'value' => '女',],
			['status', 'in', 'range' => [0, 1]],
			['phone', 'string', 'min' => 11, 'max' => 11],
			['time', 'default', 'value' => time(),],
		];
	}
}